package com.simulation.superlotto.MN;

import com.simulation.superlotto.SuperlottoApplication;
import com.simulation.superlotto.common.utils.SpringContextUtil;
import com.simulation.superlotto.model.Contrast;
import com.simulation.superlotto.model.Superlotto;
import com.simulation.superlotto.model.Winn;
import com.simulation.superlotto.service.SuperlottoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import java.util.List;
import java.util.Scanner;

/**
 * @author ：黄坤
 * @date ：创建于 2020/11/30
 * @description ：
 * @version: 1.0
 */
@Component
public class TestDaLeTou2 {
    @Autowired
    private static SuperlottoService superlottoService;
    /**
     * 单机版本 模拟兑奖验证
     * @param args
     */
    public static void main(String[] args) {
        SpringApplication.run(SuperlottoApplication.class,args);
        ApplicationContext applicationContext = SpringContextUtil.getApplicationContext();
        superlottoService = applicationContext.getBean(SuperlottoService.class);
        Scanner sc = new Scanner(System.in);
        System.out.println("查询历史中奖期数功能已开启");
        System.out.println("请输入开奖期数");
        long l = sc.nextLong();
        Winn judge = superlottoService.judge(l);
        while (StringUtils.isEmpty(judge)){
            System.out.println("未查询到该期的开奖数据,请重新输入");
            l=sc.nextLong();
            judge=superlottoService.judge(l);
        }
        System.out.println("查询到"+l+"期开奖号码:");
        System.out.println(judge);




    }

}
